#pragma once
#include "CFrameworkElement.h"
class CSolidColorBrush;
#include "CRasterizerEdgeStore.h"

class CTransitionCollection;
class HitTestPolygon;
class CRasterizerPath;

class CPanel :
	public CFrameworkElement
{

protected: 
	CPanel(CCoreServices * pCore);
	virtual ~CPanel();
	virtual XINT32 CanHaveChildren();
public: 
	static HRESULT Create(CDependencyObject * * ppObject, CREATEPARAMETERS * pCreate);
	virtual XUINT32 GetTypeIndex() const;
	virtual XBOOL GetIsLayoutElement();
	virtual XBOOL AreChildrenInLogicalTree();
	virtual HRESULT SetValue(CDependencyProperty * pdp, CValue * pValue);
	virtual HRESULT ClearValue(CDependencyProperty * pdp);
	virtual HRESULT GetBoundingRectangle(struct XRECTF_WH * pRect);
	static void NWSetBackgroundDirty(CDependencyObject * pTarget, enum DirtyFlags::Value flags);
	static HRESULT EnsureTransitionStorageForChildren(CPanel * pPanel);
	virtual void GetIndependentlyAnimatedBrushes(CSolidColorBrush * * ppFillBrush, CSolidColorBrush * * ppStrokeBrush);
	HRESULT PanelGetClosestIndexSlow(struct XPOINTF location, XBOOL * pReturnValue);
protected: 
	virtual HRESULT NWRenderPreChildrenEdgesVirtual(const struct SharedRenderParams & sharedRP, const struct NWRenderParams & nwRP, xvector<xref_ptr<CRasterizerEdgeStore> > & vecEdgeStores);
	virtual CTransitionCollection * GetTransitionsForChildElementNoAddRef(CUIElement * pChild);
	virtual XBOOL NWIsContentDirty();
	virtual void NWCleanDirtyFlags();
	virtual void EnsureContentRenderDataVirtual(enum RenderWalkType oldType, enum RenderWalkType newType);
private: 
	HRESULT GenerateEdgesCommon(XBOOL fRegenerateGeometry, XBOOL fBackgroundChanged, const CMILMatrix * pTransform, CLayer * pLayer, xvector<xref_ptr<CRasterizerEdgeStore> > & vecEdgeStores);
private: 
	void ReleaseWalkSpecificResources(enum RenderWalkType lastRenderedType);
protected: 
	virtual HRESULT D2DPreChildrenRenderVirtual(const struct SharedRenderParams & sharedRP, const struct D2DRenderParams & d2dRP);
	virtual HRESULT D2DHitTestSelf(struct XPOINTF ptHit, CUIElement * * ppResult);
	virtual HRESULT D2DComputeInnerBounds(struct XRECTF_RB * pInnerBounds);
	virtual HRESULT D2DEnsureResources(const struct D2DPrecomputeParams & cp, const CMILMatrix * pMyAccumulatedTransform);
	virtual HRESULT PreChildrenPrintVirtual(const struct SharedRenderParams & sharedPrintParams, const struct D2DPrecomputeParams & cp, const struct D2DRenderParams & printParams);
	virtual HRESULT GenerateContentBounds(struct XRECTF_RB * pBounds);
	HRESULT GenerateContentBoundsImpl(struct XRECTF_RB * pBounds);
	virtual HRESULT HitTestLocalInternal(const HitTestPolygon & target, XBOOL * pHit);
	virtual HRESULT HitTestLocalInternal(const struct XPOINTF & target, XBOOL * pHit);
public: 
	CBrush * m_pBackground;
	XINT32 m_nHorizontal;
	XINT32 m_nVertical;
	XUINT32 m_bItemsHost;
	XUINT32 m_IgnoreTransitions;
	CTransitionCollection * m_pChildrenTransitions;
private: 
	XBOOL m_fNWBackgroundDirty;
	CRasterizerPath * m_pBackgroundPath;
	struct IPALAcceleratedGeometry * m_pPALBackgroundGeometry;
	struct AcceleratedBrushParams * m_pPALBackgroundBrushParams;
};
